Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
Collection Content Returns Empty String [DiscordJs]

Possible duplicate with message.content doesn't have any value in Discord.js v14

I'm trying to add a feature to my discord bot where it will send embeds and collect a series of replies and return a final result with all answers combied. Basically like a quiz with multiple questions but instead of evaluating answers, I will collect and use answers later on in a final reply from the bot.

(Like Apollo Event Creator Bot's /event command, if you will)

I was trying to do it step by step. So sent the first message in an embed. But when I create the collector (I also will try to create the collector on user dm and return final answer on the channel that command is executed but that's another question) and provide inputs from a member account, the collected content is always an empty string ('')

I've tried various possible approachs but no matter what I do, it always return an empty string as content.

I think it's because I call the command execution in module export (since I collect commands from their files and execute them on main file) but I wasn't able to find a fix.

Here is my collector code:

module.exports = {
  data:command,
    async execute(interaction) {
    await interaction.reply({ embeds: [NewEmbed] })
    const collector = interaction.channel.createMessageCollector({ time: 15000 });

    collector.on('collect', m => {
      console.log(`Collected ${m.content}`);
    });
    
    collector.on('end', collected => {
      console.log(`Collected ${collected.size} items`);
    });
  } 
}

I basically use DiscordJs Command Handling to call and execute my commands in their own file.

In above code m.content is always an empty string. Even though it collects the correct number of replies.

client.on('interactionCreate', async interaction => {
    if (!interaction.isChatInputCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});

And that's how I execute my commands on the main file. All other commands work just fine so there is no error there (command calling wise)

Really bugging me for days. Thanks for the replies in advance!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda